package com.config;

import com.entity.Car;
import com.entity.Person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

@Configuration
/*@ComponentScan(basePackages = "com")*/

public class SpringConfiguration {

    @Bean(value = "p1", initMethod = "initPerson", destroyMethod = "destoryPerson")
    public Person getPerson() {
        return new Person("zhangsan", "男", 20,null);
    }

    @Bean("p2")
    public Person getPerson1() {
        return new Person("张三", "女", 20,null);
    }

    @Bean("car1")
    public Car getCar() {
        return new Car("BMW", "black");
    }

    @Bean("car2")
    public Car getCar1() {
        return new Car("大众", "white");
    }
}